<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-car-edit" th:object="${car}">
            <input name="carId" th:field="*{carId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车牌号码：</label>
                <div class="col-sm-8">
                    <input name="carNum" th:field="*{carNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">号牌种类：</label>
                <div class="col-sm-8">
                    <select name="carNumType" class="form-control m-b" th:with="type=${@dict.getType('car_num_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{carNumType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">号牌颜色：</label>
                <div class="col-sm-8">
                    <input name="carNumColour" th:field="*{carNumColour}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆型号：</label>
                <div class="col-sm-8">
                    <input name="carModel" th:field="*{carModel}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆状态：</label>
                <div class="col-sm-8">
                    <select name="carState" class="form-control m-b" th:with="type=${@dict.getType('car_state')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{carState}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">发动机号：</label>
                <div class="col-sm-8">
                    <input name="carEngineNum" th:field="*{carEngineNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆类型：</label>
                <div class="col-sm-8">
                    <select name="carType" class="form-control m-b" th:with="type=${@dict.getType('car_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{carType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车身颜色：</label>
                <div class="col-sm-8">
                    <input name="carColour" th:field="*{carColour}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">机动车所有人：</label>
                <div class="col-sm-8">
                    <input name="carOwner" th:field="*{carOwner}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车辆品牌：</label>
                <div class="col-sm-8">
                    <input name="carBrand" th:field="*{carBrand}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">身份证号码：</label>
                <div class="col-sm-8">
                    <input name="ownerNum" th:field="*{ownerNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">身份证明名称：</label>
                <div class="col-sm-8">
                    <input name="ownerName" th:field="*{ownerName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">事故次数：</label>
                <div class="col-sm-8">
                    <input name="accidentsNum" th:field="*{accidentsNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">违法次数：</label>
                <div class="col-sm-8">
                    <input name="violationsNum" th:field="*{violationsNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">最近定验日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="latestCheckDate" th:value="${#dates.format(car.latestCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "car/car";
        $("#form-car-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-car-edit').serialize());
            }
        }

        $("input[name='latestCheckDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>